package com.birdboot.entity;

import java.io.Serializable;

public class User implements Serializable {
    private String username;
    private String password;
    private String nickname;
    /*
        后期开发中，基本不用int值保存数字，会改为它的包装类。这样做的好处是如果用户没有
        传递值，默认值为null。如果是基本类型则是0，此时如果用户输入的是0那么无法通过0
        来区分用户是否给值
     */
    private Integer age;
    /*
        后期框架可以辅助创建实体对象，通常会使用无参构造器
     */
    public User(){}

    public User(String username, String password, String nickname, Integer age) {
        this.username = username;
        this.password = password;
        this.nickname = nickname;
        this.age = age;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", nickname='" + nickname + '\'' +
                ", age=" + age +
                '}';
    }
}
